package de.fuberlin.inf.alp3.ue06;

public class Addition extends BinaryOp {

    Addition(Expression left, Expression right) {
        super(left, right);
    }

    @Override
    public Expression eval() {
        try {
            return new Integer(((Integer) left.eval()).getValue() + ((Integer) right.eval()).getValue());
        } catch (ClassCastException e) {
            throw new RuntimeException("Operands of Addition must be integers");
        }
    }
}
